﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ucHostFile.ascx.cs" Inherits="WCrawler.Controls.ucHostFile" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="ajaxToolkit" %>

    <asp:UpdatePanel ID="SearhThreadUpdatePaneL" runat="server">
        <ContentTemplate>
    <div>

        <asp:Button ID="btnCheckLinks" runat="server" onclick="btnCheckLinks_Click" 
            Text="Check Links" />

        <asp:Button ID="btnAddFiles" runat="server" OnClick="btnAddFiles_Click" 
            Text="Add Files" style="width: 83px" />

    </div>
    <asp:GridView ID="gridViewFilePosts" runat="server" Width="100%" 
        AutoGenerateColumns="False" DataKeyNames="FilePostId" 
        DataSourceID="FilePostLinqDataSource" BackColor="LightGoldenrodYellow" 
        BorderColor="Tan" BorderWidth="1px" CellPadding="2" ForeColor="Black" 
        onrowdatabound="gridViewFilePosts_RowDataBound" AllowSorting="True">
    <EmptyDataTemplate>
        <asp:Label ID="lblEmptySearch" runat="server" Font-Bold="True" 
                ForeColor="#0033CC">No Results Found....  
            </asp:Label>
    </EmptyDataTemplate>
    <AlternatingRowStyle BackColor="PaleGoldenrod" />
    <Columns>
        <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
        <asp:TemplateField HeaderText="Post" SortExpression="Posts.PostTitle">
            <ItemTemplate>
                <asp:HyperLink ID="PostTitle" NavigateUrl='<%#"~/frmPosts.aspx?PostId=" + Eval("Post.PostId") %>' runat="server" Text='<%#Bind("Post.PostTitle")%>' />
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Host" SortExpression="Host.HostName">
            <ItemTemplate>
                <b>
                <asp:Label ID="lblHost" runat="server" 
                        Text='<%# Bind("Host.HostName") %>'></asp:Label>
                &nbsp</b>
            </ItemTemplate>
            <ControlStyle Width="30%" />
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Files" SortExpression="FilesUrl">
            <ItemTemplate>
                <asp:Label ID="lblFilesUrl" runat="server" Text='<%# Bind("FilesUrl") %>'></asp:Label>
            </ItemTemplate>
            <EditItemTemplate>
                <asp:TextBox ID="txtFilesUrl" runat="server"
                    Rows="10" Text='<%# Bind("FilesUrl") %>' TextMode="MultiLine" Height="100px" 
                        Width="100%"></asp:TextBox>
            </EditItemTemplate>
        </asp:TemplateField>
    </Columns>
    <FooterStyle BackColor="Tan" />
    <HeaderStyle BackColor="Tan" BorderStyle="Solid" Font-Bold="True" />
    <PagerStyle BackColor="PaleGoldenrod" ForeColor="DarkSlateBlue" 
            HorizontalAlign="Center" />
    <SelectedRowStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" />
    <SortedAscendingCellStyle BackColor="#FAFAE7" />
    <SortedAscendingHeaderStyle BackColor="#DAC09E" />
    <SortedDescendingCellStyle BackColor="#E1DB9C" />
    <SortedDescendingHeaderStyle BackColor="#C2A47B" />
</asp:GridView>

<div>
    <!-- Popup show full content-->
    <asp:Button id="btnShowPopup" runat="server" style="display:none" />
    <ajaxToolkit:ModalPopupExtender ID="mdlPopup" runat="server" 
        PopupControlID="PanelHtmlCode"
        TargetControlID="btnShowPopup"
        BackgroundCssClass="BackgroundStyle"
        >
    </ajaxToolkit:ModalPopupExtender>
    <asp:Panel ID="PanelHtmlCode" runat="server" BackColor="#ffffff"
       BorderColor="#dadada" BorderStyle="Solid" BorderWidth="4px"
        Width="800px" Font-Names="Arial" Font-Size="10pt">
   <table cellpadding="10" cellspacing="0" style="width: 100%">
      <tr>
         <td>
             <asp:TextBox ID="txtHmtlCode" runat="server" Rows="10" Width="100%" 
                 TextMode="MultiLine"></asp:TextBox>
         </td>
      </tr>
      <tr>
         <td align="center" valign="middle">
            <asp:Button ID="btnAdd" runat="server" Text="Add Files" onclick="btnAdd_Click" />
            <asp:Button ID="btnCancel" runat="server" Text="Cancel" /><br />
            <asp:Label ID="lblMessage" runat="server" Text=""></asp:Label>
         </td>
      </tr>
   </table>
    </asp:Panel>
</div>

</ContentTemplate>
    </asp:UpdatePanel>
<asp:LinqDataSource ID="HostLinqDataSource" runat="server" 
        ContextTypeName="WCrawlerLib.LinqDataClassesDataContext" EntityTypeName="" 
        TableName="Hosts">
</asp:LinqDataSource>
<asp:LinqDataSource ID="FilePostLinqDataSource" runat="server" 
        ContextTypeName="WCrawlerLib.LinqDataClassesDataContext" EntityTypeName="" 
        TableName="FilePosts" 
        EnableDelete="True" 
        EnableUpdate="True" OrderBy="PostId" 
    onselecting="FilePostLinqDataSource_Selecting">
</asp:LinqDataSource>